/**
 * 
 */
package com.cqan.system.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cqan.entity.pk.LongEntity;


/**
 * @Description 初始化配置信息
 * @author slaton.wu@gmail.com
 * @date 2012-7-19上午10:23:18
 *
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "TBL_SYSTEM_CONFIG")
//默认的缓存策略.
@SuppressWarnings("serial")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SystemConfig extends LongEntity{

	public enum ConfigType{
		OTHER,PRODUCT,SYSTEM,EMAIL;
		
		public String getLabel(){
			switch (this) {
			case SYSTEM:
				return "系统配置";
			case EMAIL:
				return "EMAIL配置";
			case PRODUCT:
				return "APP配置";
			case OTHER:
				return "其它配置";
			}
			return "未知";
		}
		
	}
	
	private ConfigType configType;
	
	private String description;
	
	private boolean enabled;
	
	private String key;
	
	/**
	 * appid 
	 */
	private Long pid;
	
	private String value;

	@Column(name="CONFIG_TYPE")
	@Enumerated(EnumType.STRING)
	public ConfigType getConfigType() {
		return configType;
	}

	@Column(name="DESCRIPTION")
	public String getDescription() {
		return description;
	}

	@Column(name="INFO_KEY",nullable=true)
	public String getKey() {
		return key;
	}

	@Column(name="PID")
	public Long getPid() {
		return pid;
	}

	@Column(name="INFO_VALUE")
	public String getValue() {
		return value;
	}

	@Column(name="ENABLED")
	public boolean isEnabled() {
		return enabled;
	}

	public void setConfigType(ConfigType configType) {
		this.configType = configType;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}


	public void setKey(String key) {
		this.key = key;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}
	
	public void setValue(String value) {
		this.value = value;
	}
	
	
}
